<div id="container" style="width:90%; margin:0 auto;"></div>

<div class="SipeiStat border_3 pb20 centered back_bgf mt20"><!--区外学校对比分析-统计-->
  <h1 class="clearfix pl20 mb20 fonts_18 height40 fontc_444 fontw_normal back_bgfd">成绩汇总(各等级分数及人数)</h1>
  <form class="clearfix pt20 pr20 pb20 pl20">
    <table class="fontc_666 height32">
      <thead class="back_bgf5 fontc_999">
        <tr>
          <th width="63" align="center" class="border_d">学科</th>
          <th width="64" align="center" class="border_d">总人数</th>
         
          <?php if (!empty($grading)): 
          			$grading_array = array();	
          ?>
          	<?php foreach ($grading as $gv): 
          			$grading_array[] = $gv['grading_name'];
          			
          	?>
          	<th width="87" align="center" class="border_d"><?php echo $gv['grading_name']; ?>人数</th>
          	
          	<th width="87" align="center" class="border_d"><?php echo $gv['grading_name']; ?>分数</th>
          	<?php endforeach; ?>
          <?php 
      			$grading_data = json_encode($grading_array);
          endif; ?>
          
        </tr>
      </thead>
      
      <tbody class="fontc_444">
      <?php $subject_datas = array();?>
       <?php if (!empty($subject)): ?>
          	<?php foreach ($subject as $sv):
					
          	?>
        <tr>
        
          <td align="center" class="border_d"><?php echo $sv['subject_name']; ?></td>
          <td align="center" class="border_d"><?php echo $sv['count']; ?></td>          
          
           <?php if (!empty($grading)): 
           				
           ?>
          	<?php foreach ($grading as $gv): ?>
          		
          <td align="center" class="border_d">
          <?php if (!empty($point[$sv['subject_id']]['sum'.$gv['id']])){
      
         			echo $point[$sv['subject_id']]['sum'.$gv['id']];
         			
          			$temp[] = $point[$sv['subject_id']]['sum'.$gv['id']];
          			$list['data'] = $temp;
          		}else{
          				echo '0';          			
          		}
          ?>
          </td>
          
		<td align="center" class="border_d">
		<?php echo (!empty($point[$sv['subject_id']]['grading_data']['score'.$gv['id']])) ? $point[$sv['subject_id']]['grading_data']['score'.$gv['id']]['score'] : 0;?>
		</td>
	          	<?php endforeach; ?>
          <?php endif; ?>
        </tr>
    
	<?php
				$list['name'] = $sv['subject_name'];
          		$subject_datas[] = $list;
          		unset($list);
          		unset($temp);
          		
	?>
        	<?php endforeach; ?>

          <?php 
          endif; ?>
          <?php $photo_subject = json_encode($subject_datas);
          		?>
      </tbody>
    </table>
  </form>
 
</div>








<script type="text/javascript">
		
		function charts_line( type,categories,data ){
			$('#container').highcharts({
				title: {
					text: '成绩汇总',
					x: 0 //
				},
				subtitle: {
					text: type,
					x: 0
				},
				xAxis: {
					categories: categories
				},
				yAxis: {
					title: {
						text: ''
					},
					plotLines: [{
						value: 0,
						width: 1,
						color: '#808080'
					}]
				},
				tooltip: {
					valueSuffix: '人'
				},
				credits: {
					text: '',
					href: 'http://www.example.com'
				},
				series:data 
			});
			
		
		}
		
$(function () {

	var type = '（各等级分数及人数）',
		categories = <?php echo $grading_data; ?>,
		data = <?php echo $photo_subject; ?>;
	

      
       
	charts_line( type,categories,data )
        
});
    

		</script>